home *** CD-ROM | disk | FTP | other *** search
- Path: mother.usf.edu!news
- From: yatesc@csee.usf.edu (Randy Yates)
- Newsgroups: comp.lang.c++
- Subject: Specifying a Member Function Address For WNDCLASS Structure
- Date: 22 Feb 1996 05:16:04 GMT
- Organization: University of South Florida
- Message-ID: <4ggu6k$5c1@mother.usf.edu>
- NNTP-Posting-Host: ppp53.cfr.usf.edu
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- Hello,
-
- I'm writing a MS-Windows 3.1 program and I'd like to have the
- message processing procedure for the window class be a member
- function, but Borland C++ 4.0 complains with a
-
- Error GAMECON.CPP 25: Cannot convert 'long (pascal GameControl::*)(unsigned int,unsigned int,unsigned
- int,long)' to 'long (pascal *)(unsigned int,unsigned int,unsigned int,long)'
-
-
- The definition goes something
- like this:
-
- class GameControl
- {
- private:
- HWND hWnd;
- public:
- GameControl(HINSTANCE, int);
- long FAR PASCAL _export WndProc(HWND, UINT, UINT, long);
- };
-
- GameControl::GameControl(HINSTANCE hInstance, int nCmdShow)
- {
- // static char szAppName[] = "GameControl";
- WNDCLASS wndclass;
-
- // Create the window:
- wndclass.style = CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = &GameControl::WndProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInstance;
- wndclass.hIcon = LoadIcon(hInstance, "USF_Bull");
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = GetStockObject(BLACK_BRUSH);
- wndclass.lpszMenuName = NULL;
- wndclass.lpszClassName = PINBULL_CLASSNAME;
-
- RegisterClass(&wndclass);
-
- hWnd = CreateWindow(
- PINBULL_CLASSNAME,
- "PinBull Wizard Game Control",
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- HWND_DESKTOP,
- NULL,
- hInstance,
- NULL);
-
- ShowWindow (hWnd, nCmdShow);
- UpdateWindow (hWnd);
- }
-
- long FAR PASCAL _export GameControl::WndProc(HWND hWnd, UINT message, UINT wParam, long lParam)
- {
- switch (message)
- {
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- break;
- }
- }
-
- I would love to discuss this with anyone who has run into the same/similar
- problem and found a fix.
-
- --
- % Randy Yates % "...the answer lies within your soul
- % EE/Mathematics Student % 'cause no one knows which side
- % University of South Florida % the coin will fall."
- % <yatesc@csee.usf.edu> % 'Big Wheels', *Out of the Blue*, ELO
-
-